﻿using System;
using System.Collections.Generic;
using OpenWaves.Web.Controls;

namespace OpenWaves.Web.Tests
{
    public partial class NavigationTests : System.Web.UI.Page
    {
        public List<NavigationNode> TestNodes = new List<NavigationNode>();

        protected override void OnDataBinding(EventArgs e)
        {
            this.TestNodes.Add(
                new NavigationNode(
                    Url.ParseRelative("/a"),
                    "A", "",
                    new NavigationNode(Url.ParseRelative("/a/1"), "A.1", "", 
                        new NavigationNode(Url.ParseRelative("/a/1/x"), "A.1.X", "")),
                    new NavigationNode(Url.ParseRelative("/a/2"), "A.2", "")));

            this.TestNodes.Add(
                new NavigationNode(Url.ParseRelative("/b"), "B", ""));

            this.TestNodes.Add(
                new NavigationNode(
                    Url.ParseRelative("/c"), "C (Invisible)", "", false));

            this.TestNodes.Add(
               new NavigationNode(
                   Url.ParseRelative("/d"), "D", "", true));
        }
    }

    public class TestNavigation : Navigation
    {
        public string CurrentUrl { get; set; }

        protected override AbsoluteUrl ResolveCurrentUrl()
        {
            return Url.Parse(this.CurrentUrl).ResolveAgainst(this.Page.Request.GetRawUrl());
        }
    }
}